<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>
        写一个函数 求m-n之间数字的和？
    </p>
    <input type="text" placeholder="第一个数字">
    <input type="text" placeholder="第二个数字">
    <input type="button" value="计算" onclick="getResult()">
    <span id="span"></span>
    <script>
        function getResult() {
            let sumOne = parseInt(document.getElementsByTagName('input')[0].value);
            let sumTwo = document.getElementsByTagName('input')[1].value;
            let res = 0;
            let str = "";
            for (let i = sumOne; i <= sumTwo; i++) {
                i != sumTwo ? str += i + '+' : str += i;
                res += i;
            }
            str += '=' + res
            document.getElementById('span').innerHTML = str;
        }
    </script>
</body>

</html>